package org.example.filter;

import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * filter 算子
 */
public class DataFilter {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<Integer> source = env.fromElements(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

//        source.filter((FilterFunction<Integer>) value -> {
//            if (value % 2 == 0) {
//                return true;
//            }
//            return false;
//        }).print();

        source.filter(value -> value > 5).print();
        env.execute();
    }
}